package com.shell.arouter.demo.view

import android.content.Context
import android.graphics.Canvas
import android.graphics.Color
import android.graphics.Paint
import android.util.AttributeSet
import android.view.View
import com.durian.base.utils.UIUtils

class PieView : View{

    private var w = 0
    private var h = 0
    private val paint by lazy {
        Paint().apply {
            isAntiAlias = true
            color = Color.BLACK
            textSize = UIUtils.dip2px(30.0).toFloat()
        }
    }

    constructor(context: Context?) : super(context)
    constructor(context: Context?, attrs: AttributeSet?) : super(context, attrs)
    constructor(context: Context?, attrs: AttributeSet?, defStyleAttr: Int) : super(context, attrs, defStyleAttr)

    override fun onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int) {
        super.onSizeChanged(w, h, oldw, oldh)
        this.w = w
        this.h = h
    }

    override fun onDraw(canvas: Canvas?) {
        super.onDraw(canvas)
        canvas?.apply {
//            translate(w * 1.0f/ 2,h * 1.0f / 2)
//            scale(-1f,1f)
            drawText("周涛111",0f,0f,paint)
        }
    }

}